package com.hgvip.service;

import com.hgvip.entity.Grid;
import com.hgvip.mapper.GridMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author arnold.zhu
 * @date 2018/3/2
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class GridService {

    private Logger logger = LoggerFactory.getLogger(GridService.class);

    @Autowired
    private GridMapper gridMapper;

    public List<Grid> findGrids() {
        return gridMapper.findGrids();
    }

    public void insertGrids(List<Grid> grids) {
        try {
            gridMapper.insertGrids(grids);
        } catch (Exception e) {
            logger.error("insertGrid遇到错误:", e);
        }
    }

}
